home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / edit / jed207.lha / macros / stackwins < prev   
Text File  |  1993-01-04  |  1KB  |  89 lines

  1. ; (c) 1992-3 J.Harper
  2. ; macro to stack windows
  3.  
  4. ; (stackwins <dir> <type>)
  5. ; <dir>        `x' or `y' (direction to stack in)
  6. ; <type>    `a', `v' or `f' (what windows to stack)
  7.  
  8. ; now ignores sleeping windows.
  9.  
  10. (macro `stackwins'
  11. {
  12.     (local
  13.     `maxx'   (info `screenx')
  14.     `maxy'   (info `screeny')
  15.     `maxwin' @
  16.     `actwin' 0
  17.     `i'      @
  18.     `type'   (arg 2 `s' `type (a/v/f)> ')
  19.     )
  20.  
  21.     (select
  22.     (== type `a')
  23.     {
  24.         (= `maxwin' (info `windows'))
  25.     }
  26.     (== type `v')
  27.     {
  28.         (= `maxwin' (info `views'))
  29.     }
  30.     (== type `f')
  31.     {
  32.         (= `maxwin' (info `files'))
  33.     }
  34.     {
  35.         (settitle (format `error: unknown type %s' type))
  36.         (return)
  37.     }
  38.     )
  39.  
  40.     (= `i' 0)
  41.     (while {(!= i maxwin)}
  42.     {
  43.     (if (! (info `asleep'))
  44.     {
  45.         (= `actwin' (+ actwin 1))
  46.     })
  47.     (= `i' (+ i 1))
  48.     (nextwind type)
  49.     })
  50.  
  51.     (if (== (arg 1 `s' `direction (x/y)> ') `y')
  52.     {
  53.     (local
  54.         `sizey' (/ maxy actwin)
  55.         `curry' 0
  56.     )
  57.  
  58.     (= `i' 0)
  59.     (while {(!= i maxwin)}
  60.     {
  61.         (if (! (info `asleep'))
  62.         {
  63.         (position 0 curry maxx sizey)
  64.         (= `curry' (+ curry sizey))
  65.         })
  66.         (nextwind type)
  67.         (= `i' (+ i 1))
  68.     })
  69.     }
  70.     {
  71.     (local
  72.         `sizex' (/ maxx actwin)
  73.         `currx' 0
  74.     )
  75.  
  76.     (= `i' 0)
  77.     (while {(!= i maxwin)}
  78.     {
  79.         (if (! (info `asleep'))
  80.         {
  81.         (position currx 0 sizex maxy)
  82.         (= `currx' (+ currx sizex))
  83.         })
  84.         (nextwind type)
  85.         (= `i' (+ i 1))
  86.     })
  87.     })
  88. })
  89.